$(function(){

    layui.use(['form','layer'],function(){
        var layer = layui.layer,
            form = layui.form();

        form.on('submit(submit)',function( data ){

            $.ajax({
                url : '/Bulletin/audit',
                type : 'POST',
                data : data.field,
                dataType : 'json',
                beforeSend : function(){
                    layer.load(2, { shade : [0.5,'#fff'] });
                },
                success : function ( response ) {
                    if (response.code) {
                        layer.closeAll();
                        layer.alert(response.msg);
                    } else {
                        location.reload();
                    }
                }
            });
            return false;
        })
    })
})